package com.promis.widget.mediapicker.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by jidanbo on 2018/3/26.
 */

public class ImageParcelable extends MediaParcelable implements Parcelable {

    public String compressPath;

    public String httpOriginalPath;

    public int httpWidth;

    public int httpHeight;

    public ImageParcelable(String path, String name, long time, long size, int id, String parentDir) {
        super(path, name, time, size, id, parentDir);
    }

    public ImageParcelable(String httpPath) {
        this("", "", 0, 0, 0, "");
        this.httpOriginalPath = httpPath;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeString(this.compressPath);
        dest.writeString(this.httpOriginalPath);
        dest.writeInt(this.httpWidth);
        dest.writeInt(this.httpHeight);
    }

    protected ImageParcelable(Parcel in) {
        super(in);
        this.compressPath = in.readString();
        this.httpOriginalPath = in.readString();
        this.httpWidth = in.readInt();
        this.httpHeight = in.readInt();
    }

    public static final Creator<ImageParcelable> CREATOR = new Creator<ImageParcelable>() {
        @Override
        public ImageParcelable createFromParcel(Parcel source) {
            return new ImageParcelable(source);
        }

        @Override
        public ImageParcelable[] newArray(int size) {
            return new ImageParcelable[size];
        }
    };
}
